<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>流程编辑</title>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/font-awesome.min.css"/>
    <script src="__PUBLIC__/js/jquery-1.10.0.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/go.js"></script>
    <script src="__PUBLIC__/js/flow/flow-design.js"></script>
    <style>
        #design-head{
            height:45px;
            line-height:45px;
            background-color: #ddd;
        }
        #btn-save{margin-left:40px;}
        #myDiagramDiv{
            border:1px solid #ddd;
            border-top:none;
            background-image:url('__PUBLIC__/img/flow-bg.jpg')
        }
        #myPaletteDiv{
            border: solid 1px #ddd;
            border-top:none;
            border-left:none;
        }
        #mySavedModel{
            display: none;
        }
        #container-left{
            padding-right:0;
        }
        #container-right{
            padding-left:0;
        }
    </style>
</head>
<body>
<div id="design-head" class="container-fluid">
    <div class="nav">
        {$process.name}
        <button id="btn-save" onclick="ajaxSave()" class="btn btn-primary">保存</button>
        &#12288;
        <button id="btn-save-draft" onclick="ajaxSave(1)" class="btn btn-info">保存草稿</button>
    </div>
</div>
<div class="container-fluid" style="">
    <div class="row">
        <div id="container-left" class="col-xs-1">
            <div id="myPaletteDiv"></div>
        </div>
        <div id="container-right" class="col-xs-11">
            <div id="myDiagramDiv"></div>
        </div>
    </div>
</div>
<textarea id="mySavedModel">
    <if condition="empty($design)">
        { "class": "go.GraphLinksModel",
        "linkFromPortIdProperty": "fromPort",
        "linkToPortIdProperty": "toPort",
        "nodeDataArray": [
        ],
        "linkDataArray": [
        ]}
        <else/>
        {$design}
    </if>

</textarea>
<!--设置条件-->
<div class="modal fade" tabindex="-100" id="conditionModal" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog" role="document" style="z-index: 1050">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">设置条件</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" id="btn-condition-save" class="btn btn-primary">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!--设置审批人-->
<div class="modal fade" tabindex="-100" id="disposeModal" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog" role="document" style="z-index: 1050">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">设置审批人</h4>
            </div>
            <div class="modal-body">
                <input id="dispose1" type="radio" name="dispose" value="deptLeader"/>
                <label for="dispose1">部门负责人</label>
                <input id="dispose2" type="radio" name="dispose" value="role"/>
                <label for="dispose2">角色</label>
                <input id="dispose3" type="radio" name="dispose" value="user"/>
                <label for="dispose3">用户</label>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" id="btn-dispose-save" class="btn btn-primary">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>
<script>
    var processCode = "{$process.code}";
    var design = "{design}";
    if(design==""){
        design = { "class": "go.GraphLinksModel",
            "linkFromPortIdProperty": "fromPort",
            "linkToPortIdProperty": "toPort",
            "nodeDataArray": [
            ],
            "linkDataArray": [
            ]};
    }
    //$("#mySavedModel").val(design);
    window.onload= function(){
        init();
    };
</script>